"use strict"
!function(win) {
    let dapUid = 0
    class Dep{
        constructor(vm) {
            this.$vm = vm
            this.$subscriber = []
            this.uid = dapUid++
        }

        static target
    
        // 通知观察者数据变更
        notice(value) {
            this.$subscriber.forEach((subscriber) => {
                subscriber.update(value)
            })
        }
    
        // 添加订阅者
        addSubscriber(watcher) {
            // 添加订阅
            if (this.$subscriber.indexOf(watcher) === -1) {
                this.$subscriber.push(watcher)
            }
        }
    }

    win.Dep = Dep
}(window)
